In [27]:
import numpy as np
# generate a numpy matrix
x = np.arange(20.0).reshape(4, 5)
x
Out[27]:
Get first column
In [28]:
x[:,0]
Out[28]:
Get first row
In [29]:
x[0,:]
Out[29]:
Get everything besides the first column
In [30]:
x[:,1:5]
Out[30]:
Get everything besides the first columns without knowing the number of columns
In [32]:
row,col = x.shape
x[:,1:col]
Out[32]: